/**
 * Copyright (c) 2014 zhenrongbao.com, Inc. All Rights Reserved
 * @author: jiangshuguang
 * @Date  : 14-11-14
 * @Time  : 下午3:00
 * @brief :
 */
(function () {
    var Digital = require('index:widget/ui/digital/digital.js').Digital,
        $page = $('.index-demand'),
        $btnEnableRecharge = $page.find('.recharge-container .btn-main'),
        $btnDisableRecharge = $page.find('.recharge-container .btn-disable'),
        $usableAmount = $page.find('.usable-amount');


    new Digital({
        'container':$page.find(".products .credit"),
        'number': P.data('plat_usable_amount')
    });


//    if($.browser.msie){
//        window.scrollTo(0,0);
//    }else{
//        $('body').animate({scrollTop:820},500);
//    }


//    function refresh(){
//        $.get('/index/getproductusable',{
//            pid:1
//        },function(ret,status){
//            var amount = parseInt(ret.data.plat_usable_amount);
//            if(amount>0){
//                $btnEnableRecharge.show();
//                $btnDisableRecharge.hide();
//                $usableAmount.text(mathUtil.formatAmount(amount,0));
//            }else{
//                $btnEnableRecharge.hide();
//                $btnDisableRecharge.show();
//                $usableAmount.text(0);
//            }
//        },"json");
//    }
//
//    setInterval(function(){
//        refresh();
//    },5000);


})();